package com.example.administrator.greendaotestdemo;

import android.database.sqlite.SQLiteDatabase;

/**
 * 项目名：CommonlyUsed
 * 包名：com.example.administrator.commonlyused
 * 创建者：任剑波
 * 创建时间：2018/9/17   15:21
 * 描述：TODO
 */
public class GreenDaoHelper {private static DaoMaster.DevOpenHelper mHelper;
    private static SQLiteDatabase mDb;
    private static DaoMaster mDaoMaster;
    private static DaoSession mDaoSession;
    /**
     * 设置greenDao
     */
    public static void initDatabase() {
        mHelper = new DaoMaster.DevOpenHelper(MdApplication.mContext, "notes-db", null);
        mDb = mHelper.getWritableDatabase();
        mDaoMaster = new DaoMaster(mDb);
        mDaoSession = mDaoMaster.newSession();
    }
    public static DaoSession getDaoSession() {
        return mDaoSession;
    }
    public static SQLiteDatabase getDb() {
        return mDb;
    }
}
